package com.sinosoft.tcmemr.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sinosoft.tcmemr.entity.PatientEntity;
import com.sinosoft.tcmemr.manager.PatientManager;



@Service
public class PatientService {
	
	/**病人管理类*/
	@Autowired
	private PatientManager patientManager; 
	
	/**
     * 增加病人信息
     * @param patient
     * @return true/false
     */
    public boolean addPatient(PatientEntity patient){
    	return patientManager.insertSelective(patient);
    }
    
    /**
     * 查询病人信息
     * @param id
     * @return PatientEntity
     */
    public PatientEntity getPatientByPrimaryKey(Integer id){
    	return patientManager.selectByPrimaryKey(id);
    }

    /**
     * 根据条件病人病历ID查询
     * @param ehrId病人唯一ID
     * @return 病人列表
     */
    public List<PatientEntity> getPatientsBySearchEHRID(String ehrId){
    	return patientManager.selectBySearchEHRID(ehrId);
    }
    
    /**
     * 根据身份证查询
     * @param identifyCardid
     * @return 病人列表
     */
    public List<PatientEntity> getPatientsBySearchByIdentifyCard(String identifyCardid){
    	return patientManager.selectBySearchByIdentifyCard(identifyCardid);
    }
    /**
     * 根据条件查询
     * @param name 姓名
     * @param gender性别
     * @param birthday生日
     * @return 病人列表
     */
    public List<PatientEntity> getPatientsBySearchCon(String name,String gender,Date birthday){
    	return patientManager.selectBySearchCon(name, gender, birthday);
    }
    
    
}
